import { defineStore } from 'pinia'
import util from '@/utils/util'

export const useUserStore = defineStore('user', {
  state: () => {
    return {
      token: '',
      loginState: false,
      info: {
        id: 0,
        nickname: '',
        avatar: '',
        mobile: '',
        gender: 0,
        tag: {
          id: 0,
          name: ''
        },
        follow_num: 0,
        fans_num: 0,
        like_num: 0
      }
    }
  },
  actions: {
    setToken(token: string) {
      this.token = token
      util.setLocal('token', token)
    }
  }
})
